//
//  SportDetailModel.m
//  StormWatch
//
//  Created by 王岩 on 2024/9/14.
//

#import "SportDetailModel.h"

@implementation SportDetailModel

+ (instancetype)creatModelWithInfo:(NSArray *)arr {
    SportDetailModel * model = [[SportDetailModel alloc] init];
    
    model.type = strtoll([[NSString stringWithFormat:@"0x%@",arr[0]] UTF8String], 0, 16) ;

    model.startTime =strtoll([[NSString stringWithFormat:@"0x%@",arr[1]] UTF8String], 0, 16) ;
    model.sportTime = [NSString stringWithFormat:@"%lld",strtoll([[NSString stringWithFormat:@"0x%@",arr[2]] UTF8String], 0, 16)] ;
    model.stepValue = [NSString stringWithFormat:@"%lld",strtoll([[NSString stringWithFormat:@"0x%@",arr[3]] UTF8String], 0, 16)] ;
    model.caloValue = [NSString stringWithFormat:@"%lld",strtoll([[NSString stringWithFormat:@"0x%@",arr[4]] UTF8String], 0, 16)] ;
    model.distanceValue = [NSString stringWithFormat:@"%lld",strtoll([[NSString stringWithFormat:@"0x%@",arr[5]] UTF8String], 0, 16)] ;
    model.rateValue = [NSString stringWithFormat:@"%lld",strtoll([[NSString stringWithFormat:@"0x%@",arr[6]] UTF8String], 0, 16)] ;
    
    model.timeYMDStr = [SWTool timeWithYearMonthDayCountDown:[NSString stringWithFormat:@"%ld",model.startTime] Format:@"yyyy-MM-dd"];
    model.timeHMSStr = [SWTool timeWithYearMonthDayCountDown:[NSString stringWithFormat:@"%ld",model.startTime] Format:@"HH:mm:ss"];
    
    
    return model;
}

@end
